/**
 * 
 */
package travibot.model.materials;

import travibot.model.Material;

/**
 * @author macekpet
 * 
 */
public class AbstractMaterial implements Material {

    private int id;

    private String name;

    /*
     * (non-Javadoc)
     * 
     * @see travibot.model.Material#getId()
     */
    public int getId() {

        return id;
    }

    /*
     * (non-Javadoc)
     * 
     * @see travibot.model.Material#getName()
     */
    public String getName() {

        return name;
    }

    public void setId(int id) {

        this.id = id;
    }

    public void setName(String name) {

        this.name = name;
    }
    
    @Override
    public boolean equals(Object obj) {

        if(null == obj || !(obj instanceof AbstractMaterial))
            return false;
        
        AbstractMaterial otherMat = (AbstractMaterial)obj;
        
        return (id == otherMat.getId());
    }

    @Override
    public int hashCode() {

        return String.valueOf(id).hashCode();
    }

}
